#ifndef AUTH_PARSE_H
#define AUTH_PARSE_H

#include "typedefs.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct AuthInfo_ {
	uint32_t version;
	uint64_t modules;
	uint64_t deadline;
	uint32_t count;
	char* state;
} AuthInfo;

#define FREE_AUTH_INFO(info) do { \
	    if ((info).state != NULL) { \
	        free((info).state); \
	    } \
	    memset(&(info), 0, sizeof(info)); \
	} while (0)


int parse_auth_info(const AuthBlob* data, AuthInfo* info);

int parse_state(const AuthBlob* data, char** stateEn, char** stateZh);

#ifdef __cplusplus
}
#endif

#endif //AUTH_PARSE_H

